package com.example.client.controller;

import com.example.commonapi.pojo.UAT;
import com.example.topicservice.service.TopicService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class BaseController {
    private static final Log logger = LogFactory.getLog(BaseController.class);

    @Reference(version = "${demo.service.version}")
    TopicService topicService;

    @RequestMapping("/")
    public String index(HttpServletRequest request){
        List<UAT> uats = topicService.getAllUAT();
        request.setAttribute("uats", uats);
        return "index";
    }

    @RequestMapping("/test")
    public String test() {
        return "test";
    }
}
